import { Options, Vue } from 'vue-class-component'
import navigator from '@/components/common/navigator.vue'
import store from '@/store'

interface IOrder {
  orderId: number
  userId: string
  commodityId: string
  goodsPrice: number
  payWay: number
  payTime: Date
}
@Options({
  components: {
    navigator
  }
})

export default class personCenter extends Vue {
  userId = '0'
  orderParams : IOrder[] = []

  mounted () {
    if (store.state.u !== null) {
      this.userId = store.state.u.userId
      store.dispatch('selectAllOrders', this.userId)
        .then(response => {
          this.orderParams = response.data.data
        }).catch(() => {
          console.log('connect failed')
        })
    }
  }
}
